<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>交通工具监测 - 智驭安行</title>
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        /* 监测页面特定样式 */
        .monitor-container {
            display: grid;
            grid-template-columns: 1fr 300px;
            gap: 20px;
            margin-bottom: 30px;
        }
        
        .video-section {
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
            padding: 20px;
        }
        
        .video-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 15px;
            color: #333;
            border-bottom: 1px solid #eee;
            padding-bottom: 10px;
        }
        
        .video-container {
            position: relative;
            width: 100%;
            height: 400px;
            background-color: #f0f0f0;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .video-simulation {
            position: relative;
            width: 100%;
            height: 100%;
            background-color: #222;
        }
        
        .video-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 10;
        }
        
        .video-info {
            position: absolute;
            top: 10px;
            left: 10px;
            background-color: rgba(0, 0, 0, 0.5);
            color: white;
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 12px;
            display: flex;
            gap: 10px;
        }
        
        .detection-box {
            position: absolute;
            border: 2px solid #ff0000;
            background-color: rgba(255, 0, 0, 0.2);
            display: none;
        }
        
        .detection-box span {
            position: absolute;
            top: -25px;
            left: 0;
            background-color: #ff0000;
            color: white;
            padding: 2px 8px;
            font-size: 12px;
            white-space: nowrap;
        }
        
        .video-placeholder {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-size: 16px;
            text-align: center;
        }
        
        .camera-controls {
            display: flex;
            justify-content: space-between;
            margin-top: 15px;
        }
        
        .camera-selector {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }
        
        .camera-btn {
            background-color: #f0f0f0;
            border: 1px solid #ddd;
            border-radius: 4px;
            padding: 5px 10px;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .camera-btn:hover,
        .camera-btn.active {
            background-color: #0066cc;
            color: white;
            border-color: #0066cc;
        }
        
        .view-controls {
            display: flex;
            gap: 10px;
        }
        
        .view-btn {
            background-color: #f0f0f0;
            border: 1px solid #ddd;
            border-radius: 4px;
            padding: 5px 10px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .view-btn:hover {
            background-color: #e6f0ff;
        }
        
        .alerts-section {
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
            padding: 20px;
            height: 100%;
            display: flex;
            flex-direction: column;
        }
        
        .alerts-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 15px;
            color: #333;
            border-bottom: 1px solid #eee;
            padding-bottom: 10px;
        }
        
        .alerts-container {
            flex: 1;
            overflow-y: auto;
            max-height: 400px;
        }
        
        .alert-item {
            padding: 10px;
            border-radius: 5px;
            margin-bottom: 10px;
            background-color: #f9f9f9;
            border-left: 3px solid #ddd;
            transition: all 0.3s;
        }
        
        .alert-item.new {
            background-color: #fff8e6;
            border-left-color: #ffcc00;
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.4); }
            70% { box-shadow: 0 0 0 10px rgba(255, 204, 0, 0); }
            100% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0); }
        }
        
        .alert-time {
            font-size: 12px;
            color: #888;
            margin-bottom: 5px;
        }
        
        .alert-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .alert-type {
            font-weight: 500;
        }
        
        .alert-actions {
            display: flex;
            gap: 5px;
        }
        
        .alert-actions button {
            background-color: #f0f0f0;
            border: 1px solid #ddd;
            border-radius: 4px;
            padding: 3px 8px;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .btn-view-alert:hover {
            background-color: #e6f0ff;
            border-color: #0066cc;
            color: #0066cc;
        }
        
        .btn-ignore:hover {
            background-color: #ffe6e6;
            border-color: #cc0000;
            color: #cc0000;
        }
        
        .stats-section {
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
            padding: 20px;
            margin-bottom: 30px;
        }
        
        .stats-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 15px;
            color: #333;
            border-bottom: 1px solid #eee;
            padding-bottom: 10px;
        }
        
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 15px;
        }
        
        .stat-item {
            background-color: #f9f9f9;
            border-radius: 8px;
            padding: 15px;
            text-align: center;
        }
        
        .stat-item .label {
            font-size: 14px;
            color: #666;
            margin-bottom: 5px;
        }
        
        .stat-item .value {
            font-size: 24px;
            font-weight: 600;
            color: #333;
            transition: all 0.3s;
        }
        
        .stat-item .value.increased {
            color: #00aa00;
            animation: fadeIn 1s;
        }
        
        .stat-item .value.decreased {
            color: #cc0000;
            animation: fadeIn 1s;
        }
        
        @keyframes fadeIn {
            from { opacity: 0.5; }
            to { opacity: 1; }
        }
        
        .anomaly-details {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }
        
        .anomaly-info {
            background-color: #f9f9f9;
            border-radius: 8px;
            padding: 15px;
        }
        
        .anomaly-info h3 {
            font-size: 16px;
            margin-bottom: 15px;
            padding-bottom: 5px;
            border-bottom: 1px solid #eee;
        }
        
        .info-item {
            display: flex;
            margin-bottom: 10px;
        }
        
        .info-item .label {
            width: 100px;
            font-weight: 500;
        }
        
        .status-pending {
            color: #ff9900;
        }
        
        .status-processed {
            color: #00aa00;
        }
        
        .actions {
            margin-top: 20px;
            display: flex;
            gap: 10px;
        }
        
        .actions button {
            padding: 8px 15px;
            border-radius: 4px;
            border: none;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .btn-process {
            background-color: #0066cc;
            color: white;
        }
        
        .btn-process:hover {
            background-color: #0055aa;
        }
        
        .btn-export {
            background-color: #f0f0f0;
            color: #333;
        }
        
        .btn-export:hover {
            background-color: #e0e0e0;
        }
    </style>
</head>
<body>
    <header>
        <div class="container">
            <div class="logo">
                <img src="img/logo.png" alt="智驭安行">
                <span>智驭安行</span>
            </div>
            <nav>
                <ul>
                    <li><a href="index.html">首页</a></li>
                    <li><a href="#" class="active">出行服务</a></li>
                    <li><a href="#">车辆信息</a></li>
                    <li><a href="#">学习与技术支持</a></li>
                    <li><a href="#">客户服务</a></li>
                    <li><a href="#">数据</a></li>
                </ul>
            </nav>
        </div>
    </header>
    
    <div class="hero">
        <div class="container">
            <h1>交通工具异常行为监测</h1>
            <p>实时监测公共交通工具上司机和乘客的异常行为</p>
            <div class="location">
                <i class="fas fa-map-marker-alt"></i>
                <span>北京市</span>
            </div>
        </div>
    </div>
    
    <div class="main-content">
        <div class="container">
            <div class="stats-section">
                <h2 class="stats-title">监测统计</h2>
                <div class="stats-grid">
                    <div class="stat-item">
                        <div class="label">今日监测车辆</div>
                        <div class="value">128</div>
                    </div>
                    <div class="stat-item">
                        <div class="label">今日异常行为</div>
                        <div class="value">23</div>
                    </div>
                    <div class="stat-item">
                        <div class="label">司机异常行为</div>
                        <div class="value">12</div>
                    </div>
                    <div class="stat-item">
                        <div class="label">乘客异常行为</div>
                        <div class="value">11</div>
                    </div>
                </div>
            </div>
            
            <div class="monitor-container">
                <div class="video-section">
                    <h2 class="video-title">实时监控</h2>
                    <div class="video-container">
                        <div class="video-simulation">
                            <div class="video-overlay">
                                <div class="video-info">
                                    <span class="camera-id">摄像头 #1</span>
                                    <span class="timestamp">2023-06-15 14:30:45</span>
                                </div>
                                <div class="detection-box">
                                    <span>司机疲劳驾驶</span>
                                </div>
                            </div>
                            <div class="video-placeholder">实时视频监控中（模拟）</div>
                        </div>
                    </div>
                    <div class="camera-controls">
                        <div class="camera-selector">
                            <button class="camera-btn active" data-camera="1">摄像头 1</button>
                            <button class="camera-btn" data-camera="2">摄像头 2</button>
                            <button class="camera-btn" data-camera="3">摄像头 3</button>
                            <button class="camera-btn" data-camera="4">摄像头 4</button>
                        </div>
                        <div class="view-controls">
                            <button class="view-btn" data-view="live">
                                <i class="fas fa-video"></i>
                                实时
                            </button>
                            <button class="view-btn" data-view="history">
                                <i class="fas fa-history"></i>
                                历史
                            </button>
                        </div>
                    </div>
                </div>
                
                <div class="alerts-section">
                    <h2 class="alerts-title">实时告警</h2>
                    <div class="alerts-container">
                        <div class="alert-item new">
                            <div class="alert-time">14:25:30</div>
                            <div class="alert-content">
                                <div class="alert-type">检测到司机疲劳驾驶</div>
                                <div class="alert-actions">
                                    <button class="btn-view-alert">查看</button>
                                    <button class="btn-ignore">忽略</button>
                                </div>
                            </div>
                        </div>
                        <div class="alert-item">
                            <div class="alert-time">14:10:15</div>
                            <div class="alert-content">
                                <div class="alert-type">检测到乘客异常行为</div>
                                <div class="alert-actions">
                                    <button class="btn-view-alert">查看</button>
                                    <button class="btn-ignore">忽略</button>
                                </div>
                            </div>
                        </div>
                        <div class="alert-item">
                            <div class="alert-time">13:55:42</div>
                            <div class="alert-content">
                                <div class="alert-type">检测到车内可疑物品</div>
                                <div class="alert-actions">
                                    <button class="btn-view-alert">查看</button>
                                    <button class="btn-ignore">忽略</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="services-section">
                <h2>异常行为分析</h2>
                <div id="anomaly-analysis">
                    <!-- 异常行为分析内容将通过JavaScript动态加载 -->
                    <div class="chart-container">
                        <div class="chart-placeholder">加载异常行为分析图表...</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <footer>
        <div class="container">
            <div class="footer-content">
                <div class="footer-logo">
                    <img src="img/logo.png" alt="智驭安行">
                    <span>智驭安行</span>
                </div>
                <div class="footer-links">
                    <div class="link-group">
                        <h3>关于我们</h3>
                        <ul>
                            <li><a href="#">公司简介</a></li>
                            <li><a href="#">联系方式</a></li>
                            <li><a href="#">加入我们</a></li>
                        </ul>
                    </div>
                    <div class="link-group">
                        <h3>服务支持</h3>
                        <ul>
                            <li><a href="#">帮助中心</a></li>
                            <li><a href="#">常见问题</a></li>
                            <li><a href="#">技术支持</a></li>
                        </ul>
                    </div>
                    <div class="link-group">
                        <h3>法律信息</h3>
                        <ul>
                            <li><a href="#">隐私政策</a></li>
                            <li><a href="#">使用条款</a></li>
                            <li><a href="#">版权声明</a></li>
                        </ul>
                    </div>
                </div>
                <div class="footer-contact">
                    <h3>联系我们</h3>
                    <p><i class="fas fa-phone"></i> 400-123-4567</p>
                    <p><i class="fas fa-envelope"></i> contact@zhiyuanxing.com</p>
                    <div class="social-links">
                        <a href="#"><i class="fab fa-weixin"></i></a>
                        <a href="#"><i class="fab fa-weibo"></i></a>
                        <a href="#"><i class="fab fa-qq"></i></a>
                    </div>
                </div>
            </div>
            <div class="footer-bottom">
                <p>&copy; 2023 智驭安行 版权所有</p>
            </div>
        </div>
    </footer>
    
    <script src="js/main.js"></script>
    <script src="js/transport-monitor.js"></script>
    <script>
        // 更新时间戳
        function updateTimestamp() {
            const timestampElement = document.querySelector('.timestamp');
            if (timestampElement) {
                const now = new Date();
                timestampElement.textContent = now.toLocaleString();
            }
            setTimeout(updateTimestamp, 1000);
        }
        updateTimestamp();
        
        // 摄像头切换
        const cameraBtns = document.querySelectorAll('.camera-btn');
        cameraBtns.forEach(btn => {
            btn.addEventListener('click', function() {
                const cameraId = this.getAttribute('data-camera');
                
                // 更新按钮状态
                cameraBtns.forEach(b => b.classList.remove('active'));
                this.classList.add('active');
                
                // 更新摄像头ID显示
                const cameraIdElement = document.querySelector('.camera-id');
                if (cameraIdElement) {
                    cameraIdElement.textContent = `摄像头 #${cameraId}`;
                }
                
                // 模拟加载新摄像头视频
                const videoPlaceholder = document.querySelector('.video-placeholder');
                if (videoPlaceholder) {
                    videoPlaceholder.textContent = '加载摄像头视频中...';
                    setTimeout(() => {
                        videoPlaceholder.textContent = `摄像头 #${cameraId} 实时视频监控中（模拟）`;
                    }, 500);
                }
            });
        });
        
        // 视图切换
        const viewBtns = document.querySelectorAll('.view-btn');
        viewBtns.forEach(btn => {
            btn.addEventListener('click', function() {
                const viewType = this.getAttribute('data-view');
                const cameraId = document.querySelector('.camera-btn.active').getAttribute('data-camera');
                
                // 更新按钮状态
                viewBtns.forEach(b => b.classList.remove('active'));
                this.classList.add('active');
                
                // 根据视图类型更新显示
                if (viewType === 'live') {
                    // 显示实时视图
                    const videoPlaceholder = document.querySelector('.video-placeholder');
                    if (videoPlaceholder) {
                        videoPlaceholder.textContent = `摄像头 #${cameraId} 实时视频监控中（模拟）`;
                    }
                } else if (viewType === 'history') {
                    // 显示历史记录
                    const videoContainer = document.querySelector('.video-container');
                    if (videoContainer) {
                        videoContainer.innerHTML = `
                            <div class="anomaly-details">
                                <div class="anomaly-video">
                                    <div class="video-simulation">
                                        <div class="video-overlay">
                                            <div class="video-info">
                                                <span class="camera-id">摄像头 #${cameraId}</span>
                                                <span class="timestamp">2023-06-15 13:45:22</span>
                                            </div>
                                            <div class="detection-box" style="display: block; top: 40%; left: 30%; width: 40%; height: 30%;">
                                                <span>司机疲劳驾驶</span>
                                            </div>
                                        </div>
                                        <div class="video-placeholder">异常行为视频回放（模拟）</div>
                                    </div>
                                </div>
                                <div class="anomaly-info">
                                    <h3>异常行为分析</h3>
                                    <div class="info-item">
                                        <span class="label">异常类型:</span>
                                        <span class="value">司机疲劳驾驶</span>
                                    </div>
                                    <div class="info-item">
                                        <span class="label">检测时间:</span>
                                        <span class="value">2023-06-15 13:45:22</span>
                                    </div>
                                    <div class="info-item">
                                        <span class="label">置信度:</span>
                                        <span class="value">92%</span>
                                    </div>
                                    <div class="info-item">
                                        <span class="label">处理状态:</span>
                                        <span class="value status-pending">待处理</span>
                                    </div>
                                    <div class="actions">
                                        <button class="btn-process">标记为已处理</button>
                                        <button class="btn-export">导出报告</button>
                                    </div>
                                </div>
                            </div>
                        `;
                        
                        // 添加按钮事件
                        const processBtn = document.querySelector('.btn-process');
                        const exportBtn = document.querySelector('.btn-export');
                        
                        if (processBtn) {
                            processBtn.addEventListener('click', function() {
                                const statusElement = document.querySelector('.status-pending');
                                if (statusElement) {
                                    statusElement.textContent = '已处理';
                                    statusElement.className = 'value status-processed';
                                }
                                this.disabled = true;
                            });
                        }
                        
                        if (exportBtn) {
                            exportBtn.addEventListener('click', function() {
                                alert('报告已导出（模拟）');
                            });
                        }
                    }
                }
            });
        });
        
        // 告警按钮事件
        const viewAlertBtns = document.querySelectorAll('.btn-view-alert');
        const ignoreAlertBtns = document.querySelectorAll('.btn-ignore');
        
        viewAlertBtns.forEach(btn => {
            btn.addEventListener('click', function() {
                const alertItem = this.closest('.alert-item');
                const alertType = alertItem.querySelector('.alert-type').textContent;
                
                // 切换到历史视图并显示相关告警
                const historyBtn = document.querySelector('.view-btn[data-view="history"]');
                if (historyBtn) {
                    historyBtn.click();
                }
                
                // 移除新告警样式
                alertItem.classList.remove('new');
            });
        });
        
        ignoreAlertBtns.forEach(btn => {
            btn.addEventListener('click', function() {
                const alertItem = this.closest('.alert-item');
                alertItem.remove();
            });
        });
    </script>
</body>
</html>